<template>
<div>
    <HomeHeader  :type_="type_"></HomeHeader>
    <v-content>
        <v-container ><v-card>
            <v-data-table
                    :headers="items"
                    :items="getdata"
                    :items-per-page="5"
            >
            </v-data-table>
            <v-btn rounded color="primary" dark @click="show=!show">添加</v-btn>
            <v-dialog v-model="show" max-width="500px">
                <v-card>
                    <v-card-title>
                        <span class="headline">添加科室</span>
                    </v-card-title>
                    <v-card-text>
                        <v-container>
                            <v-row>
                                <v-col cols="12" sm="6" md="4" v-for="(item,i) in items" :key="i">
                                    <v-text-field :label="item.text" v-model="setdata[item.value]"></v-text-field>
                                </v-col>
                            </v-row>
                        </v-container>
                    </v-card-text>
                    <v-card-actions>
                        <v-spacer></v-spacer>
                        <v-btn color="blue darken-1" text @click="show=!show">取消</v-btn>
                        <v-btn color="blue darken-1" text @click="_addkeshi">提交</v-btn>
                    </v-card-actions>
                </v-card>
                    </v-dialog>
        </v-card></v-container >
    </v-content>
    <Home-Footer :type_="type_"></Home-Footer>
  </div>
</template>
<script>
  export default {
  data() {
    return {
        type_:"adm",
        show:false,
        items:[{text:"科室ID",value:'dep_id'},{text:"科室名称",value:'dep_name'},{text:"科室电话",value:'doc_name'},{text:"科室描述",value:'doc_name'}],
        setdata:{
            dep_id:'',
            dep_name:'',
        },
        getdata:[]
    }
  },methods: {
_addkeshi(){
    var params=this.setdata
    params._option ='1004'
    this.$http.post(params,2).then((res)=>{
        this.response=res
        this.show=!this.show
        this._begin()
        // this.show=!this.show
    }).catch((err)=>{
        this.response=err
    })
},_begin(){
              var params ={_option:'1014'}
              this.$http.post(params,2).then((res)=>{
                  let { resultCode, resultObject, resultMsg } = res
                  if (resultCode === '0') {
                      if (resultObject) {
                          this.getdata = resultObject.dataList
                          // alert(this.getdata)
// alert(this.items)
                      } else {
                          this.getdata = []
                      }
                  } else {
                      this.getdata = []
                      this.response=resultMsg
                  }
              })
          }
      },mounted() {
this._begin()
      }



  }
</script>


<style  scoped>
</style>
